
#define pinp 9

unsigned char pwm = 0;
unsigned char x;
void setup(){
  Serial.begin(9600);
  analogWrite(pinp,0);
  TCCR1B = TCCR1B & 0b11100000 | 0b00011001 ;
  TCCR1A = TCCR1A & 0b11111100 | 0b00000010;
  ICR1 = 255;
  x = TCCR1A;
  Serial.println(x,BIN);
  x = TCCR1B;
  Serial.println(x,BIN);
}

void loop(){
  
  x = Serial.read();
  if(x == 's'){
    analogWrite(pinp,pwm);
  }
  else if(x == 't'){
    analogWrite(pinp,0);
  }
  else if(x == 'a'){
    pwm++;
    analogWrite(pinp,pwm);
  }
  else if(x == 'd'){
    pwm--;
    analogWrite(pinp,pwm);
  }
  else if(x == 'z'){
    pwm += 10;
    analogWrite(pinp,pwm);
  }
  else if(x == 'c'){
    pwm -= 10;
    analogWrite(pinp,pwm);
  }
  else if(x == 'q'){
    pwm += 50;
    analogWrite(pinp,pwm);
  }
  else if(x == 'e'){
    pwm -= 50;
    analogWrite(pinp,pwm);
  }
  Serial.println(pwm,DEC);
  delay(600);
}

